logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

The delete() method in a Linked List deletes the entire list. For the following questions, state any assumptions you make about the design Write the delete function for a singly linked Write the delete function for a circly linked

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Assume a 64 bit machine with 4 byte int, 1 byte char, and 8 byte doubles for all questions.

  1. [8 points] The delete() method in a Linked List deletes the entire list. For the following questions, state any assumptions you make about the design 
  2. Write the delete function for a singly linked
  3. Write the delete function for a circly linked
  4. [8 pts] Using geometric expansion by a factor of 2, write a function that takes a pointer to an integer array, allocates more space, then returns the pointer to the reallocated You cannot make any assumptions about the array parameter (empty, full, etc) and you cannot use realloc (you may use any other library functions).
  5. [2 pts] Briefly explain why you have to return a pointer to the reallocated
  6. [6 pts] Write a C function that takes only a Binary Search Tree as a parameter and returns an array containing the data in the tree sorted in descending You may need to use a secondary recursive function to accomplish this.
  7. [6 pts] Draw the array representation after each sift-down operation in the heapify algorithm for a max-heap with a starting array of the following values: [1, 2, 4, 6, 7, 9, 10, 18, 100]
  8. [9 pts] Given a hash table with m=11 entries and the following hash function h1: h1(key) = key mod m

Insert the keys {22, 1, 13, 11, 24, 33, 18, 42, 31} in the given order (from left to right) to the hash table by drawing each of the following collision resolution methods:

  1. [3 pts] Chaining
  2. [3 pts] Linear Open Addressing
  3. [3 pts] Rehashing
    1. Draw the new array only once after
  1. [6 pts] True or False:
    1. Dynamic Arrays (Vectors) are faster and more efficient than standard arrays . Explain why this is or is not true 
    2. Function pointers must be dereferenced before you can call Explain why this is or is not true with an example.
    3. Binary Search Trees can be a return type of a function Explain why this is or is not true with an example.
    4. [3 pts] Arrays can be a return type of a function Explain why this is or is not true with an example.

 

  1. [10 pts] Given the solution for the Two Iterator Cycle Detection algorithm, write a function that takes a pointer to a Linked list as a parameter, and uses the two iterator solution to determine if there is a cycle. Your function should return a pointer to the node at the beginning of the

 

  1. [8 points] The insert() function of a Linked List traditionally appends the item to the For the following questions, state any assumptions you make about the design of the list.

 

  1. [4 pts] Write the insert function for a singly linked
  2. [4 pts] Write the insert function for a doubly linked

 

  1. [5 points] Write a C function that takes a Doubly linked list as a You must use a secondary data structure to make a deep copy of the list in reverse order of the original list and return a pointer to the new reversed list.
  2. [10 points] Draw the tree representation after max-heapifying the following array with values in the following Circle your final result. We will only grade the circled answer.:

[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100]

  1. [5 points] What would happen if you repeatedly removed the priority value from the heap in the previous question and inserted it into a standard binary search tree?

Draw a representation of the Binary Search Tree after inserting all values

For the below pseudo code, abstract out any external functions needed. For example, printNode(node) to print a node’s value.

 

12a) (3 pts) Write pseudocode for a single recursive function that takes a BST root node as a parameter and performs a deep copy of a Binary Search Tree, returning a pointer to the copy BST:

12b) (3 pts) Write pseudocode for a single recursive function that takes a BST root node as a parameter and deletes all nodes in a Binary Search tree:

12c) (3 pts) Write pseudocode for a single recursive function that takes a BST root node as a parameter and performs a sorted print in a Binary Search tree:

 

  1. (5 pts) Draw a binary search tree with the values inserted in the following order: 11, 72, 5, 20, 12, 7, 2, 1, 8, 100

 

  1. How many leaves does the tree have?
  2. What is the root?
  3. What is the tree’s max height?

 

  1. (5 pts) How would the previous Binary Tree appear in memory as an array?

 

  1. Show the steps involved when you min-heapify the array
  2. Show the steps involved (both array and logical tree) when you remove the priority value
  1. [6 points] If p is a pointer to a structure, write some C code which uses all the following code snippets:

“++p->i”, “p++->i”, “*p->i”, “*p->i++”, “(*p->i)++”, and “*p++->i”.

Describe the action of each code snippet as a comment.

 

  1. [7 points] What is the value of i after executing each of the following:

 

  1. i = sizeof(char);
  2. i = sizeof(int);
  3. int a; i = sizeof a;
  4. char b[5]; i = sizeof(b);
  5. char *c=b; i = sizeof(c);
  6. struct {int d;char e;} s; i = sizeof s;
  7. void f(int j[5]) { i = sizeof j;}

 

  1. [5 points] Use structs to define a data structure suitable for representing a binary tree of Be sure to include the methods (function pointers) required for all operations (not just public).

 

  1. [7 points] Write a function, mirror, which takes a Binary search tree as a parameter and returns a reversed version of the binary search tree, with larger values on the left and smaller values on the right (you may use an auxiliary function).
(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

664 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

936 Answers

Hire Me
expert
Husnain SaeedComputer science

623 Answers

Hire Me
expert
Atharva PatilComputer science

793 Answers

Hire Me
June
January
February
March
April
May
June
July
August
September
October
November
December
2025
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
SunMonTueWedThuFriSat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
4
5
00:00
00:30
01:00
01:30
02:00
02:30
03:00
03:30
04:00
04:30
05:00
05:30
06:00
06:30
07:00
07:30
08:00
08:30
09:00
09:30
10:00
10:30
11:00
11:30
12:00
12:30
13:00
13:30
14:00
14:30
15:00
15:30
16:00
16:30
17:00
17:30
18:00
18:30
19:00
19:30
20:00
20:30
21:00
21:30
22:00
22:30
23:00
23:30