Data Structures - Mastery Quiz 4

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Identify the correct sequence for inserting an item in a linked list.

1. Create a list node for a new item. 2. Assign a pointer of the new item to point to the next item. 3. Update the pointer of the previous node to point to the new node.

How many calls are made to the function BSTInsertRecursive when the following operations are executed on the given tree? BSTInsert(tree, node 4)BSTInsert(tree, node 10)

5 WRONG MF

Which of the following is a valid binary search tree?

6 4 8 3 5 7 8

Which code block should be used to insert a new node in an empty tree?

BSTInsert(tree, node) { if (tree⇢root == null) { tree⇢root = node node⇢parent = null return }}

Identify the correct way to insert 52 at the end of the following list: 12, 24, 36, 48.

ListAppend(list, node 52)

Which is the correct code to prepend an item to a list?

ListPrepend(list, newNode) { if (list⇢head == null) { list⇢head = newNode list⇢tail = newNode } else { newNode⇢next = list⇢head list⇢head = newNode }}

Identify the order of nodes that would be printed during a BST inorder traversal.

b. 3, 4, 5, 6, 7, 8, 9

When removing curNode from a doubly-linked list with at least 2 elements, the list's tail may be assigned with _____.

curNode's predecessor

For an empty, singly-linked list with a dummy node, the list's _____.

head and tail point to the same, non-null node

Which of the following sorting algorithms cannot be performed on a doubly-linked list?

heap sort

In the ListInsertAfter function for singly-linked lists, the curNode parameter is ignored when _____.

the list's head pointer is null

In a tree representing a file system, _____.

leaf nodes represent either files or empty directories

When calling the recursive BSTRemoveNode function to remove node 8, a recursive call is made to remove _____.

node 9

The head of the circular linked list is also called the _____ node.

start

Complete the correct code for inserting a node in a list.

tmpNext = this->nextNodePtr; this->nextNodePtr = nodeLoc; nodeLoc->nextNodePtr = tmpNext;


Set pelajaran terkait

Anatomy Chapter 12 - immunology (like mine)

View Set

psy 230 statistics of behavioral sciences exam 1

View Set

AHN 02 & BPN 43 NCLEX Review Questions

View Set

Chapter 11: high-risk perinatal care- existing conditions

View Set

Emergency Equipment Introduction

View Set

Chapter 34 Patients with Special Challenges

View Set

Ms. Szymanski Physics Chapter 21

View Set