ICS_Homeworks/6_Data_Abstraction.md

2.6 KiB

If the number of leaf nodes in a binary tree is 2n (where n is a positive integer), then the entire tree would contain at least

2n + 1 - 1 nodes

Two special forms of lists are the LIFO structures known as .............(1) , in which entries are inserted and removed from the .............(2), and FIFO structures known as .............(3) in which entries are removed from the .............(4) and inserted at the .............(5).

  1. stacks, a stack
  2. top
  3. queues, a queue
  4. head
  5. tail

If a queue contained the entries w, x, y, z (from head to tail), which of the following would be the contents after two entries were removed and the entry r was inserted?

y, z, r

If the two-dimensional array X were stored in row-major order, then in the block of main memory containing X, which of the following would be true?

The entry X[1,2] would appear before X[2,1].

I hate tables at this point, but there it is

Another table

The table below represents a portion of a computer's main memory containing a binary tree stored row by row in a contiguous block as described in the chapter. What are the children of the node B?

Address Content
50 A
51 B
52 C
53 D
54 E
55 F
56 G

D and E, E and D

(Author's note: I FOUND THE FUCKING QUESTION HERE)

What sequence of nodes from the tree would be printed if the following recursive procedure were applied to it? (The procedure uses a global stack called Stack that is assumed to begin empty.)

Tree

procedure printTree (Tree)

   if (Tree is not empty)

     then (push the current node on Stack;

           apply the procedure printTree to the right subtree of Tree)

   if (Stack is not empty)

     then (pop an entry from Stack and print that node)

G,C,A

Which of the following is a LIFO structure?

Stack

Which of the following is not a means of locating an entry in a linked storage structure?

NIL pointer

Which of the following is not used when determining the location of an entry in a two-dimensional homogeneous array stored in row-major order?

Number of rows in the array

In a machine language, the technique in which the data to be manipulated by an instruction is included within the instruction itself is called

Immediate addressing