Answers for "pseudocode array"

0

pseudocode array

CREATE array c having size = array length a + aray length b
SET aIdx to 0
SET bIdx to 0
SET cIdx to 0
WHILE aIdx < length of a - 1 and bIdx < length of b - 1
  IF a [aIdx] < b [bIdx] THEN
    SET c[cIdx] to a[aIdx]
    INCREMENT aIdx
    INCREMENT cIdx
  ELSE
    SET c[cIdx] to b[bIdx]
    INCREMENT bIdx
    INCREMENT cIdx
  ENDIF
ENDWHILE

WHILE aIdx < length of a - 1
  SET c[cIdx] to a[aIdx]
  INCREMENT aIdx
  INCREMENT cIdx
ENDWHILE

WHILE bIdx < length of b - 1
  SET c[cIdx] to b[bIdx]
  INCREMENT bIdx
  INCREMENT cIdx
ENDWHILE

RETURN c
Posted by: Guest on September-15-2021

Browse Popular Code Answers by Language