Pseudo Code Review Arrays Level 1

Home Forums Grade 12 IB Pseudo Code Review Arrays Level 1

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #6945
    Eamonn
    Keymaster

    Pseudo Code Review Arrays level 1

    //==== Checking Lists for Duplicates ====================
    // Write a program compares two lists, stored in Arrays,
    // output any duplicate names that appear in both lists.
    TENNIS = [“Al”,”Bobby”,”Carla”,”Dave”,”Ellen”]
    BBALL = [“Lou”,”Dave”,”Hellen”,”Alan”,”Al”]

    #6970
    girwan
    Participant

    TENNIS = […]
    BBALL = […]
    LOOP I FROM 0 TO N-1
    LOOP J FROM 0 TO N-1
    IF TENNIS[I] = BBALL[J] THEN // COMPARES ONE ELEMENT OF TENNIS WITH EACH ELEMENT OF BBALL
    OUTPUT TENNIS[I]
    END IF
    END LOOP
    END LOOP

    #6971
    Shiva Chandnani
    Participant

    TENNIS = [“Al”,”Bobby”,”Carla”,”Dave”,”Ellen”]
    BBALL = [“Lou”,”Dave”,”Hellen”,”Alan”,”Al”]

    loop for i from 0 to n-1
    loop for j from 0 to n-1
    if tennis[I] = Bball[j] then
    output tennis[i]
    end if
    end loop
    end loop

    #6972
    Sang
    Participant

    TENNIS = [“Al”,”Bobby”,”Carla”,”Dave”,”Ellen”]
    BBALL = [“Lou”,”Dave”,”Hellen”,”Alan”,”Al”]

    loop i from 0 to n-1
    loop j from o to n-1

    #6973
    Irfan
    Participant

    TENNIS = [“Al”,”Bobby”,”Carla”,”Dave”,”Ellen”]
    BBALL = [“Lou”,”Dave”,”Hellen”,”Alan”,”Al”]
    duplicate = “0”
    ta = “0”
    loop ta from 0 to 4
    if ta = BBALL
    duplicate = TENNIS[ta]
    end loop

    output[duplicate]

    #6975
    joshua7
    Participant

    TENNIS = [“Al”,”Bobby”,”Carla”,”Dave”,”Ellen”
    BBALL = [“Lou”,”Dave”,”Hellen”,”Alan”,”Al”]

    for Tennis from 0 to n-1
    for BBall from 0 to n-1
    if TENNIS[] = BBALL[]
    Output Tennis[]

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Scroll to Top