Write a function called max consecutive integers

Assignment Help C/C++ Programming
Reference no: EM131035733

1. set the marker U for the unsorted section at the end of the list (U is an integer index value)

2. while the unsorted section has more than one element do steps 3 through 7

3. set the current element marker C at the second element of the list (C is an integer index value)

4. while C has not passed U do steps 5 and 6

5. if the item at position C is Less than the item to its left then exchange these two items

6. move C to the right one position

7. move U left one position

8. stop

Your implementation for this function may NOT use strcpy ( ) . You may only exchange or swap pointers, but NOT actually make copies of the strings!

3. Write a recursive function called sum_primes () that accepts an unsigned integer, n, as an argument, and returns the sum of all primes from 2 to n. You must use recursion to solve this problem!

4. Write a function called smallest_sum_sequence ( ) that accepts an array of signed integers and the number of items in the array as arguments, and returns the smallest sum of a sequence of numbers in the array. A sequence is defined as a single item or multiple items that are in adjacent memory Locations.

5. Write a function called max_consecutive_integers () that accepts a two-dimensional array of signed integers, the number of rows, the number of columns as input parameters, and two pointers as output parameters (one of these pointers is actually a pointer to a pointer, i.e. two stars!). The function finds the maximum consecutive sequence of one integer. The first pointer stores the address the start of the maximum consecutive sequence of the same integer. The second indirectly stores the number the same consecutive integers in a row. These sequences may wrap from one row to the next. For example ([$xxxx] denotes address value):

Row/Column

0

1

2

3

4

0

-5

6

0

P         2

2                   .•

 

[$1000]

[$1004]

[$1008]

[$1012]

[$1016]

1

2

2

2

9

3

 

[$1020]

[$1024]

[$1028]

[$1032]

[$1036]

2

3

3

2

1

-8

 

[$1040]

[$1044]

[$1048]

[$1052]

[$1056]

3

7

-2

6

0

4

 

[$1060]

[$1064]

[$1068]

[$1072]

[$1076]

The function should store the address of row 0, column 3 ($1012) via the first pointer, and 5 (2, 2, 2, 2, 2) indirectly via the second pointer.

Verified Expert

This assignment is about writing user defined functions in header file and source file. These defined functions are tested by main method in c. This assignment is implemented in c using visual c++ 2015.header.h contains function declarations Source.c contains function definitions for the functions declared in header.h main.c contains testing functions definied in surce.c

Reference no: EM131035733

Questions Cloud

When one commits a criminal act that wrongful deed : If a person engages in illegal activities, such as drug dealing, and one hides the origins of the income, besides tax problems, there may be a crime of: The theft of valuable business information, such as a trade secret is: When one commits a crimina..
Determine the tensions and developed in the tape : If the coefficient of static friction between the tape and the drive wheel and between the tape and the fixed shafts A and C is µs = 0.1 , determine the tensions and developed in the tape for equilibrium.
Financial data of the cavendish cove cottages case study : Using the financial information from the case study and the information listed below, calculate the net margins: Using the financial data of the Cavendish Cove Cottages case study, calculate the (ROE) for 2008 :
Determine if the 80-kg man can keep the 300-kg : The coefficients of static friction between the rope and the peg and between the man's shoes and the ground are µs = 0.1 and µ's = 0.4, respectively
Write a function called max consecutive integers : Write a function called max consecutive integers () that accepts a two-dimensional array of signed integers, the number of rows, the number of columns as input parameters.
Probability of a couple getting a boy : The probability of a couple getting a boy child is 0.5 and getting a girl is 0.65 . If the couple plans to get three children find the probability that at least there is a boy.
Determine the least number of full turns : The coefficients of static friction between the rope and the peg and between the man's shoes and the ground are µ's = 0. 4and µs = 0.1, respectively.
Find the probability that all of them are boys : The probability of a couple getting a boy child is 0.6 and getting a girl is 0.7 . If the couple plans to get three children find the probability that all of them are boys.
Changes in sales cause changes in profits : Changes in sales cause changes in profits. Would the profit change associated with sales changes be larger or smaller if a firm increased its operating leverage? Explain your answer.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Describe your experiences on writing your first c program

Describe your experiences on writing and testing your first C program. Gives examples of where you got stuck?. What difficulties you faced? What did you learn from this experience?

  You are required to prepare a program for assessment system

you are required to prepare a program for assessment system of a university. the main idea is to evaluate the gpa

  Customer to select a type of coffee

Starbucks, Inc. has hired you to create an application that will help their customer's pre-order coffee for one week. In this test environment, Starbucks has elected to use a selected set of coffees for this application. The program will offer the..

  Write a recursive function

Write a recursive function, vowels, that returns the number of vowels in a string and write the definitions of the functions to overload the operators defined in parts a to c.

  The project is to design and write a c11fltk game program

the project is to design and write a c11fltk game program with a graphical user interface. the game is based on

  Two types of constructors

Explain what constructors do and when they are executed. Explain the two types of constructors. Provide an example class that includes both types of constructor functions and demonstrate how an object would be instantiated using both types of constru..

  State private portion of class to model the item

In c++ state the private portion of a class to model the given item: a class Date for dates consisting of a month, day and year. a class PhoneNumber for a telephone numbers consisting of area code, local exchange, and number.

  Imagine a circular linked list of integers and explain it

imagine a circular linked list of integers that are sorted into ascending order as shown in the attached file. The external pointer list points to the last node, which contains the largest integer.

  Create a new animal that flys with a jetpack

Create a new animal that flys with a jetpack. This will require a new fly behavior and a new class. This new animal eats kale.

  Advantages of compilers and interpreters

Discuss the advantages and disadvantages of compilers and interpreters

  Structure plan in matlab

Tic-Tac-Toe (a.k.a. Noughts and crosses) is a game played by two players (‘X' and ‘O') on a 3x3 grid. In MATLAB, use a 3x3 cell array to hold the board information. Take it in turns to play the game, inserting ‘X's and ‘O's at various spots. Imple..

  Display a year-by-year depreciation schedule

Create GUI screen interface that accepts input and shows output and resize the GUI screen & the list box to best fit the output displayed

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd