Coder Social home page Coder Social logo

varanasi-software-junction / datastructures Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 5.0 3.32 MB

A repository on Data Structures

License: MIT License

C++ 64.04% C 25.86% PHP 9.87% HTML 0.24%
arrays sorting searching linked lists trees graphs more

datastructures's People

Contributors

champaksworld avatar champaksworldcreate avatar maurya232abhishek avatar prashant-7748 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

datastructures's Issues

Arrays

array is a collection of items of the same type stored in contiguous memory locations.

defining arrays:
int a[]={1,2,3};
int b[10];
int c[3]={9,0,8};
int d[10]={0,9};
int e[3]={9,8,7,6,5};//Error

finding length of an array:
input : int n=sizeof(d)/sizeof(int);
printf("%d",n);

output : 10

for printing the numbers :
for(int i=0;i<=n-1;i++)
{
printf("%d,",a[i]);

}

Arrays part 2

  1. Sorting of an Array
  2. kth largest element of an array, also kth smallest
  3. min and max element of an Array
  4. merge 2 array first in ascending and second in descending oder
  5. diffference betwwen largest and smallest element of the Array
  6. remove the repeated element
  7. print the odd and event element from the Array
  8. Find subsequences that add up to n
  9. Partition between odd and even numbers
  10. Sorting: Bubble sort , Merge sort , Quick sort , Heap sort , Insertion sort

Problems on OOPS

  1. Make a class Person with the fields name, phone, and address. Implement constructor, print and destructor
  2. Make a class Time that stores time in 24 hrs format and prints in 12 hr format
  3. Make a class Currency that stores rupees and paise and adjusts properly. Override all operators
  4. Inherit Person into Employee and add post and salary
  5. Implement friend class and methods
  6. Implement virtual methods and pure virtual method. Differentiate between virtual methods and non-virtual methods
  7. Implement Generic methods and classes

If else

  1. Find the max of three numbers
  2. Check for a leap year
  3. Solve a Quadratic Equation
  4. Check the type of a Triangle. Is triangle possible, Equilateral, Isosceles, Scalene and Right Angled
  5. Check for pass, fail and division given marks in 3 subjects. 40 is passing marks. 3rd division >=40 <50, >=50 <60 2nd, >=60 1st.
  6. Convert 0-9 digits to words
  7. Find the days in month given the month no and year
  8. Find the quadrant given the angle
  9. Solve the above programs using ternary operator
  10. Solve the above programs using switch

Pointer

  1. C program to demonstrate declaration of pointer variables.
  2. C program prints address of a variable and a variable can be assigned different address in different runs.
  3. C program to illustrate Array Name as Pointers in C.
  4. C program to Reverse an array using pointer.
  5. C program sort an array using pointer.
  6. C program for differentiate passing by pointer and passing by reference.
  7. C program to illustrate concept of the pointers to constant.
  8. C program to illustrate concept of the constant pointers to pointers
  9. C program to illustrate concept of the constant pointers
  10. C program to check if a string is palindrome using pointers.
  11. C program to find length of string using pointer arithmetic.
  12. C Program to compare two strings using Pointers.

Problems on Arrays -1

  1. Search for an element in an array
  2. Count occurrences of an element in an array
  3. Find a sub array in an array
  4. Find max element in an array
  5. Find second max in an array
  6. Arrange odd/even or -ve/+ve numbers in an array
  7. Store Fibonacci numbers in an array
  8. Check for a palindrome array
  9. Compare 2 arrays
  10. Remove duplicates in an array

Summation of loops

  1. Find the sum of 1st n numbers
  2. Find factorial of a number
  3. Print the Fibonacci series both forward and reverse
  4. Find x to the power y
  5. Calculate the square root of a number
  6. Find e to the power x
  7. Find sin(x) and Cos (x)
  8. Find Prime numbers

Switch

Here are ten programming problems that you can solve using the switch statement in C:

  1. Write a program that takes a number as input and displays the corresponding month name using a switch statement.
  2. Create a program that prompts the user for a day of the week (e.g., 1 for Monday, 2 for Tuesday) and prints a message indicating whether it's a weekday or a weekend.
  3. Implement a calculator program that performs basic arithmetic operations (addition, subtraction, multiplication, division) based on the operator input using a switch statement.
  4. Write a program that takes a character as input and determines whether it is a vowel or a consonant using a switch statement.
  5. Create a program that converts a given letter grade (A, B, C, D, or F) into a corresponding GPA value using a switch statement.
  6. Implement a menu-based program that allows the user to choose different options (e.g., add, subtract, multiply, divide) and perform the corresponding operation using a switch statement.
  7. Write a program that takes a month number (1-12) as input and prints the number of days in that month using a switch statement.
  8. Create a program that prompts the user for a shape (e.g., circle, square, triangle) and calculates the area based on the user's choice using a switch statement.
  9. Implement a program that converts a given temperature in Celsius to Fahrenheit or vice versa based on the user's choice using a switch statement.
  10. Write a program that takes a character as input and determines whether it is an uppercase letter, lowercase letter, digit, or special character using a switch statement.

These problems will help you practice using the switch statement in C and improve your problem-solving skills. Good luck!

Ternary

Sure! Here are 10 problems related to the ternary operator in the C programming language:

  1. Write a program that takes three numbers as input and uses the ternary operator to find the maximum among them.
  2. Create a program that calculates the sum of all even numbers from 1 to n using the ternary operator.
  3. Write a C program that uses the ternary operator to determine whether a given year is a leap year or not.
  4. Implement a program that checks whether a given number is positive, negative, or zero using the ternary operator.
  5. Create a program that calculates the factorial of a given number using the ternary operator.
  6. Write a C program that takes two integers as input and uses the ternary operator to swap their values.
  7. Implement a program that calculates the average of three numbers using the ternary operator.
  8. Create a program that determines whether a given character is a vowel or a consonant using the ternary operator.
  9. Write a C program that takes three integers as input and uses the ternary operator to find the minimum among them.
  10. Implement a program that checks whether a given number is even or odd using the ternary operator.

These problems should help you practice using the ternary operator in various scenarios.

Problems on Loops -1

  1. Print the series 1,2,3,4,5,6,7,8,9,10
  2. 2,4,6,8,10
  3. 1,3,5,7,9
  4. 1,4,9,16,,,64,81,100
  5. 2,6,12,20,,,,56,72,90
  6. 1,-1,1,-1,1-1,1-1,,,
  7. 1,-2,3,-4,5,-6,7,-8,9,-10
  8. Print all this in reverse also.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.