Question
I have a review asigment and these are some of the practice questions i do not understand. This is for C programming Can you please
I have a review asigment and these are some of the practice questions i do not understand. This is for C programming
Can you please explain these so that I can understand.
1. What is the worst and average Big O runtime for the following sorting algorithms?
a. Merge
b. Insertion
c. Quick
d. Selection
e. Bubble
2. What is the issue with the following merge sort code?
f
3. List (and briefly explain) any memory management issues you notice with the following code.
4. You are building a pyramid of wooden blocks. The cross section of each layer is a square of wooden blocks. The length of each layer is one less than the previous layer (with the base layer as the only exception). You are given the length of the base of the pyramids in block length. Your objective is to write a recursive program that determines how many blocks are in the entire pyramid.
1: int mergeS (int st, int en, int* x) f 2: int mid -(st en) / 2, i; 3: int frontPtr-st, backPtr mid 1, mergedPtr e 4: int vals[en st 1]; 5: merges(st, mid, x); merges(mid + 1, en, x); 6: if (st==en) return; 8: 9: while (mergedPtren st) 10: if (frontPtrmid 1 1l (backPtr-en1 && x[frontPtr]x[backPtr])) vals[mergedPtr++] x[backPtr++]; 12: 13: 14: 15: 16: for (i = st; = en; i++) 17:xi]- vals[i - st]; 18:) else vals[mergedPtr++] -x[frontPtr++]Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started