Assignment 3 - 1 Write pseudocode to swap two adjacent...

This preview shows page 1 - 2 out of 4 pages.

1. Write pseudocode to swap two adjacent elements by adjusting only the links (and not the data) using [10 Points] a. Singly linked list void nodeSwapS (node *head) If head node and next node are the same Exit function End if If the head != null AND the the node head is pointing != null… next node point to head node head point to next next node End ifb. Doubly linked list void nodeSwapD (node *head)if head node and node next to head are the same Exit function End if If the head != null AND head is not pointing to null head front pointer point to back of next next node Next next’s back pointer point to front of head Next node point to back of head node Next node back point to null and head pointer point to next End if
2. Write pseudocode to implement the contains routine for MyLinkedList [5 Points]

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture