14 views

Uploaded by gomathisankar.v1978

c programs

- Amazon Interview Questions
- Franco Quintana Control 5
- 8
- Amazon Interview Questions 2009
- UNIT 7
- DATA STRUCTURE INTERVIEW QUESTIONS.pdf
- Fixed Outline Floorplan
- data structures
- Tutorial DS
- 123654789632587410.
- Data Structure
- 131352-LM
- Investments+Quiz+1++Key (1).docx
- 92-10
- Introduduction to Financial Programming
- EDM_MEEPE_ASM_4
- Data Structures by Yaman Singhania
- Stack
- 2017 EURODYN.pdf
- 18-avl

You are on page 1of 13

**1. Creation, update, traverse singly linked list
**

2. reverse a linked list

3. find middle of a linked list

4. loop in a linked list

5. sort a linked list

6. merge two linked lists removing duplicates.

7. Count no of nodes in a linkedlist.

8. Swap every second node in a linked list.

9. Return n th node from end

10. Free all nodes of a linked list

11. Binary search in a linked list

12. Read a singly linked list backwards

13. Compare two linked lists

14. Create copy of a linked list.

15. Split the linked list

16. Create update traverse a doubly linked list.

17. Hash table using doubly linked list.

18. Merge linked list alternatively.

19. Insert a nod into a sorted linked list.

20. Find point of intersection of two linked lists.

21. Swap k th node from the start with k th node from the last.

22. Reverse words of a sentence in a linked list.

23. Delete a node when given only address of the node in a singly linked list

24. Add node from beginning of the tree.

25. Interchange numbers using doubly linked list

26. Ad two long positive numbers represented by linked list

27. Print linked list in a sorted order.

28.

Stack

1. Implement stack using array

2. Implement stack using linkedlist

3. Convert infix to prefix

4. Infix to postfix

5. Postfix to prefix

6. Postfix to infix

7. Evaluate a an expression

8. Implement towers of hanoi

Queue

1. Implement a circular queue as a linked list

2. Implement queue using an array

3. Implement queue using a linked list

4. Implement deque

5. Implement priority queue

6.

Binary search tree

1. tree traversal

2. heigh t of a binary search tree

3. No of elements in a tree

4. Delete a tree

5. Check two trees are identical

6. Minimum value of bst

7. Mirror copy of a tree

8. Find n th node in a bst

9. Create copy of tree

10. Check bst

11. Level order traversal

12. Delete a node from BST

13. search a value in BST

14. Count no of leaves in a BST

15. Closest ancestor to a two nodes

16. Inorder successor

17. Expression tree

Avl tree

1.creation, deletion , access.

RB tree

1.creation, deletion

Trie

Hash table.

Graph

1. Depth first search

2. Breadth first search

3. Minimum cost of a spanning tree.

4. Shortest path

5. Cycle in a graph.

Searching

1. Linear search

2. Binary search

3. Binary search using recursion

Sorting

4. 1.Insertion sort

5. Bubble sort

6. Merge sort

Quick sort

7. Selection sort

8. Heap sort

9. Shell sort

10. Radix sort

Strings

1. Write a c program to convert the string from upper case to lower case.

2. Write a c program to convert the string from lower case to upper case.

3. Write a c program to delete the all consonants from given string.

4. Write a c program to count the different types of characters in given string.

5. Write a c program to sort the characters of a string.

6. Write a c program for concatenation two strings without using string.h header file.

7. Write a c program to find the length of a string using pointer.

8. Write a c program which prints initial of any name.

9. Write a c program to print the string from given character.

10. Write a c program to reverse a string

11. Reverse a string using recursion in c

12. String concatenation in c without using strcat

13. How to compare two strings in c without using strcmp

14. String copy without using strcpy in c

15. Convert a string to ASCII in c

No conversions

1. Write a c program to check given number is perfect number or not.

2. Write a c program to check given number is Armstrong number or not.

3. Write a c program to check given number is prime number or not.

4. Write a c program to check given number is strong number or not.

5. C program to check a number is odd or even.

6. Write a c program to check given number is palindrome number or not.

8. Write a c program to check given string is palindrome number or not.

7. Write a c program to solve quadratic equation.

8. Write a c program to print Fibonacci series of given range.

9. Write a c program to get factorial of given number.

10. Write a c program for Floyd’s triangle.

11. Write a c program to print Pascal triangle.

12. Write a c program to generate multiplication table.

13. Write a c program to print ASCII value of all characters.

14. C program to print hello world without using semicolon

15. Write a c program which produces its own source code as its output

1. Write a c program to reverse any number.

2. Write a c program to find out sum of digit of given number.

3. Write a c program to find out power of number.

4. Write a c program to add two numbers without using addition operator.

5. Write a c program to subtract two numbers without using subtraction operator.

6. Write a c program to find largest among three numbers using binary minus operator.

7. Write a c program to find largest among three numbers using conditional operator

8. Write a c program to find out generic root of any number.

9. Write a c program to find out prime factor of given number.

10. Write a c program to find out NCR factor of given number.

11. How to convert string to int without using library functions in c

12. Program in c to print 1 to 100 without using loop

13. C program for swapping of two numbers

14. Program to find largest of n numbers in c

15. Split number into digits in c programming

16. C program to count number of digits in a number

1. Write a c program to find out L.C.M. of two numbers.

2. Write a c program to find out H.C.F. of two numbers.

3. Write a c program to find out G.C.D. of two numbers.

1. Write a c program to swap two numbers.

2. Write a c program to swap two numbers without using third variable.

3. Write a c program for swapping of two arrays.

4. Write a c program for swapping of two string.

1. Write a c program to convert decimal number to binary number.

2. Write a c program to convert decimal number to octal number.

3. Write a c program to convert decimal number to hexadecimal number.

4. Write a c program to convert octal number to binary number.

5. Write a c program to convert octal number to decimal number.

6. Write a c program to convert octal number to hexadecimal number.

7. Write a c program to convert hexadecimal number to binary number.

8. Write a c program to convert hexadecimal number to octal number.

9. Write a c program to convert hexadecimal number to decimal number.

10. Write a c program to convert binary number to octal number.

11. Write a c program to convert binary number to decimal number.

12. Write a c program to convert binary number to hexadecimal number.

13. C program for addition of binary numbers .

14. C program for multiplication of two binary numbers.

15. C program fractional binary conversion from decimal.

16. C program for fractional decimal to binary fraction conversion.

17. C program to convert decimal number to roman.

18. C program to convert roman number to decimal number.

19. C program to convert each digits of a number in words

20. C program to convert currency or number in word.

Matrix

1. Write a c program for addition of two matrices.

2. Write a c program for subtraction of two matrices

3. Write a c program for multiplication of two matrices.

4. Write a c program to find out sum of diagonal element of a matrix.

5. Write a c program to find out transport of a matrix.

6. Write a c program for scalar multiplication of matrix.

7. C program to find inverse of a matrix

8. Lower triangular matrix in c

9. Upper triangular matrix in c

10. Strassen's matrix multiplication program in c

11. C program to find determinant of a matrix

Array

1. Write a c program to find out largest element of an array.

2. Write a c program to find out second largest element of an unsorted array.

3. Write a c program to find out second smallest element of an unsorted array.

4. Write a c program which deletes the duplicate element of an array.

5. Write a c program for delete an element at desired position in an array.

6. Write a c program for insert an element at desired position in an array.

7. C program to find largest and smallest number in an array

Size of data type

1. Write a c program to find the size of int without using sizeof operator.

2. Write a c program to find the size of double without using sizeof operator.

3. Write a c program to find the size of structure without using sizeof operator.

4. Write a c program to find the size of union without using sizeof operator.

5.find offset of a field in a structure.

Bitwise programs

1. count of no of set bits or unset bits.

int countSetBits(unsigned int n)

{

unsigned int count = 0;

while(n)

{

If (n & 1)

count ++;

n >>= 1;

}

return count;

}

2.reverse the bits

3.check n th bit , set n th bit

if ( n & 1 << i )

4.reverse odd bits, even bits

unsigned int swapBits(unsigned int x)

{

// Get all even bits of x

unsigned int even_bits = x & 0xAAAAAAAA;

// Get all odd bits of x

unsigned int odd_bits = x & 0×55555555;

even_bits >>= 1; // Right shift even bits

odd_bits <<= 1; // Left shift odd bits

return (even_bits | odd_bits); // Combine even and odd bits

}

5.compare two no ising bitwise

6.addition using bitwise

7.separate the no into individual digits

8.check power of 2

if((num != 1) && (num & (num - 1)))

9.check odd or even integer

10.swap first n bits with last n bits

int swapBits(unsigned int x, unsigned int p1, unsigned int p2, unsigned int n)

{

/* Move all bits of first set to rightmost side */

unsigned int set1 = (x >> p1) & ((1U << n) - 1);

/* Moce all bits of second set to rightmost side */

unsigned int set2 = (x >> p2) & ((1U << n) - 1);

/* XOR the two sets */

unsigned int xor = (set1 ^ set2);

/* Put the xor bits back to their original positions */

xor = (xor << p1) | (xor << p2);

/* XOR the 'xor' with the original number so that the

two sets are swapped */

unsigned int result = x ^ xor;

return result;

}

11.find the only set bit

int findPosition(unsigned n)

{

if (!isPowerOfTwo(n))

return -1;

unsigned count = 0;

// One by one move the only set bit to right till it reaches end

while (n)

{

n = n >> 1;

// increment count of shifts

++count;

}

return count;

}

11.increment with arithmetic operator

int increment( int x )

{

int y = ~x; // 1's complement of x

return -y; // 2's complement of y

}

12.invert all bits in odd position

unsigned int invertBits( unsigned int x )

{

unsigned int mask = 1;

for( int i=1; i<=32; i+=2 )

{

x = x ^ mask;

mask = mask << 2;

}

return x;

}

Approach 2

unsigned int generateMask()

{

// set initial mask to all 1's

unsigned int x = ~0U;

int size = 32 / 2;

while ( size > 0 )

{

unsigned int y = x << size;

x = x ^ y ;

size = size / 2;

}

return x;

}

unsigned int invertBits( unsigned int n )

{

return x ^ generateMask();

}

12.round off to next power of 2

int nextPowerOfTwo( unsigned int x )

{

int count = 0 ;

while ( x > 0 )

{

count ++;

x = x >> 1;

}

return 1 << count;

}

Addition without operator

int Add(int x, int y)

{

// Iterate till there is no carry

while (y != 0)

{

// carry now contains common set bits of x and y

int carry = x & y;

// Sum of bits of x and y where at least one of the bits is not set

x = x ^ y;

// Carry is shifted by one so that adding it to x gives the required

sum

y = carry << 1;

}

return x;

}

Turnoff the rightmost set bit

int fun(unsigned int n)

{

return n&(n-1);

}

Compare without branching

y ^ ((x ^ y) & -(x < y))

find the no occurring odd no of times

int getOddOccurrence(int ar[], int ar_size)

{

int i;

int res = 0;

for (i=0; i < ar_size; i++)

res = res ^ ar[i];

return res;

}

- Amazon Interview QuestionsUploaded byRonak Panchal
- Franco Quintana Control 5Uploaded byFranco Quintana
- 8Uploaded bySingh Ajay
- Amazon Interview Questions 2009Uploaded byShivendra Kumar
- UNIT 7Uploaded bybadboy_rockss
- DATA STRUCTURE INTERVIEW QUESTIONS.pdfUploaded byTrisha Sur
- Fixed Outline FloorplanUploaded byRaffi Sk
- data structuresUploaded byjayaa0307
- Tutorial DSUploaded byapi-3747330
- 123654789632587410.Uploaded byhanandkumar
- Data StructureUploaded bySteven Conrad
- 131352-LMUploaded bysridharanc23
- Investments+Quiz+1++Key (1).docxUploaded byHashaam Javed
- 92-10Uploaded bymichael213
- Introduduction to Financial ProgrammingUploaded byJuanjo Perojo
- EDM_MEEPE_ASM_4Uploaded byEdvan Moyo
- Data Structures by Yaman SinghaniaUploaded byYaman Singhania
- StackUploaded byGoldy Batra
- 2017 EURODYN.pdfUploaded byRodrigo Rivero
- 18-avlUploaded byabhi231594
- C++ AssignmentUploaded byBiswadip Dey

- Mr.gomathi SankarUploaded bygomathisankar.v1978
- thiruvanmiyur_pathigamUploaded bygomathisankar.v1978
- Di ElectricsUploaded bygomathisankar.v1978
- ME-MTech_Thesis_Format.pdfUploaded bySubanth Wiiliams
- IIT-_C_Brochure__25.03.2010Uploaded bygomathisankar.v1978
- FAQ in CUploaded byapi-3829352
- karitkeyenUploaded bygomathisankar.v1978
- 8415144 400 Puzzles and Answers for InterviewUploaded byanup_nair

- Behavior of Transmission Gates en VHDLUploaded byEdgardo Ricci
- Evaluate funtion obiee11gUploaded byDevi Vara Prasad
- How to Export Data in Visual ComposerUploaded byCintia Carina Gutierrez
- Kms Server 2003Uploaded byAleksandar Škiljević
- Inversion of Control_ Overview With ExamplesUploaded byPalabPalani
- integrating-blockchain-erp.pdfUploaded byraaji
- StarWars-PBL LabtestLab Test 1Uploaded byMeng Fong
- Accommodating Deleted Columns in DatabasesUploaded byPriyanka Garg
- Any Connect 100918 Asa Sslvpn 00Uploaded bysirjuan0610
- Innovative marketing of media productsUploaded byAlexkma
- PLM240 470 en Project Controlling With WorkUploaded byMyriam Becerra Rosales
- human factorsUploaded byapi-252361076
- Markov ChainsUploaded byNouman Khan
- Bank ChainUploaded byPhani Raju
- IEEE 1901 BPL Standard PublishedUploaded byaaron2003
- Finite Element Analysis Questions OnlyUploaded byAeronaughtycs Hamdan
- v13adminUploaded byBismarck4
- Nimmi SEO ProUploaded bySaurabh Mittal
- User Story TemplateUploaded bySoubhagya Lenka
- Jean Baudrillard - Deep Blue or the Computer's MelancholiaUploaded byakrobata1
- Overview Threat Risk Assessment 76Uploaded byKwadwo Owusu
- Petrel Edit Input data 2007Uploaded byShengyun Zhan
- mca 1st sem assignment 2015-16Uploaded byAmit Ramkishor Gupta
- Vladimir Yu. Sazonov- On Feasible NumbersUploaded byNine000
- AffineUploaded byDaniel Baeza Martinez
- NA2009_ENUS_TR_09Uploaded byMarynancy Macmayor
- Alias Studiotools Sketching v13Uploaded byRodrigo Wanzeler
- Peter's Tools 1Uploaded bylmn_grss
- Reference Range ABL90Uploaded byAzhar Mohamed
- New Microsoft Word Document (2)Uploaded byJosef Anthony