Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Treasure Map and Saddle Points. This is the second part, which is also the question asked. The first part of the algorithm?. all.h #ifndef ALL_H_

Treasure Map and Saddle Points.

This is the second part, which is also the question asked.

image text in transcribed

The first part of the algorithm?.image text in transcribed

all.h

#ifndef ALL_H_

#define ALL_H_

int treasure_map1 [5][5] = { {34,21,32,41,25}, {14,42,43,14,31}, {54,45,52,42,23}, {33,15,51,31,35}, {21,52,33,13,23} };

int saddle_points1 [5][5] = { {1,2,5,4,5}, {2,3,1,4,6}, {1,2,3,4,5}, {2,4,6,8,10}, {1,3,5,7,9} };

int saddle_points2 [5][5] = { {1,2,3,4,5}, {1,2,3,4,5}, {1,2,3,4,5}, {1,2,3,4,5}, {1,2,3,4,5} };

int saddle_points3 [5][5] = { {5,4,3,2,1}, {5,4,3,2,1}, {5,4,3,2,1}, {5,4,3,2,1}, {5,4,3,2,1} };

int saddle_points4 [5][5] = { {1,2,3,4,5}, {0,2,3,4,6}, {1,2,3,4,7}, {10,10,10,10,10}, {1,5,7,9,2} };

int unsorted_numbers1 [10] = {1,5,3,4,6,7,10,2,8,4};

int unsorted_numbers2 [5] = {5,4,3,2,1};

#endif /* ALL_H_ */

1) m 1 as a function in c. Call this Follow your instructions a function from your main verifying that it works. I have provided some sample inputs that you can use to test it with in the file "all.h". The easiest way to include this into your code is to use an include statement in your c file a. Example: #include"all.h" instead of b. When including custom .h files that you made, you should use Follow your instructions and implement your algorithm for problem 2 as a function in c. Call this function from your main verifying that it works. I have provided some sample inputs that you can use to test it with in the file "all.h". The easiest way to include this into your code is to use an include statement in your c file 2) a. Example: #include"all.h" b. When including custom .h files that you made, you should seinstead of c. If you decide to create both of these functions in the same file (then call both of them from main), you only need to include all.h once 3) Below is an algorithm for sorting numbers in a list. If you follow the algorithm, you should end up with a list sorted in ascending order. Implement the algorithm below as a C function. I have provided some sample inputs that you can use to test it with in the file "all.h". Sorting Algorithm 1) function sort_numbers (A: array[1.n] of numbers) 2) for i from 1 to n-1 3) for j from 1 to n-1 4) if Alj> Alj+1] temp Al) 4b Alj+1]temp 5) for i from 1 to n 6) print: Ali+" Deliverables: C file(s) containing functions implementing algorithms for 1, 2, and 3

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions