Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider a List of integer places that is not empty and is referred to as inList. In accordance with the following line of reasoning, determine

Consider a List of integer places that is not empty and is referred to as inList. In accordance
with the following line of reasoning, determine and output outList:
Using the following principles, construct a sequence of numbers for each element in inarr,
beginning with the one that is immediately to the left of the current element:
In the series, the current element is the number that comes first in the sequence.
Using the current number as a starting point, the following formula is used to generate the next
number in the sequence:
o Divide the current number by two to determine the next number in the sequence, provided that
the current number is even.
o For the next number in the sequence, if odd, multiply the current number by three and then add
one. This will give you the next number in the sequence.
o Continue performing the processes outlined above until the number 1 is produced.
Using C program, determine how many numbers are contained in each sequence that has been
constructed. Next, add the appropriate identified counts to outList in the order that the elements
appear in inList.
Sample Input
10100
Sample Output
726
Explanation:
Input: 10100
For 10: Sequence -10,5,16,8,4,2,1(Total count =7)
For 100: Sequence -100,50,25,76,38,19,58,29,88,44,22,11,34,17,52,26,13,40,20,10,
5,16,8,4,2,1(Total count =26)
Therefore, outList =726
2. Let A and B are two unsorted arrays. Write a program to merge and sort the elements of
the arrays
3. A file contains n employee records. Each record contains Employee Name, Number and
designation level and cumulative point (reward point). Write a C program to read each

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

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions