Hey there! Sign in to join this conversationNew here? Join for free
x Turn on thread page Beta

What does the following pseudocode do with list? Singly linked list watch

Announcements
    • Thread Starter
    Offline

    0
    ReputationRep:
    Assume that list is a singly linked list with more than 1 element and identified by a pointer to its head.
    What does the following pseudocode do with list?

    Function foo( head, x ):
    p <- head
    IF NOT(p = NULL) AND p.info = x THEN
    head = p.next
    WHILE NOT (p = null OR p.next = NULL)
    IF p.next.info = x
    p.next = p.next.next
    ELSE p = p.next
 
 
 
Reply
Submit reply
Turn on thread page Beta
TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

Updated: October 31, 2015
Poll
Do you agree with the proposed ban on plastic straws and cotton buds?

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Write a reply...
Reply
Hide
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.