Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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?

image text in transcribedf

3. List (and briefly explain) any memory management issues you notice with the following code.

image text in transcribed

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.

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago