Giter Site home page Giter Site logo

dsl_assignment's Introduction

Hey, I'm Raj Shende ๐Ÿ‘‹

  • ๐Ÿ”ญ Iโ€™m currently working on ... Web Developement and Compititive conding
  • ๐ŸŒฑ Iโ€™m currently learning ...Data structure and Algorithms
  • โœจ Having keen interest in Problem solving
  • ๐Ÿ“ซ How to reach me: ... Email - [email protected]
  • โšก Fun fact: ... I scroll social media lot
  • languages


-

Web Development

-






Github_stats
Top_languages

dsl_assignment's People

Contributors

shenderaj9021 avatar

Watchers

 avatar

dsl_assignment's Issues

#include <iostream> #include <algorithm> using namespace std; void swaps(int x,int y){ int temp =x; x=y; y=temp; } void heapify(int arr[],int n,int i){ int largest =i; int l=2*i+1; int r=2*i+2; if(l<n && arr[l]>arr[largest]){ largest=l; if(r<n && arr[r]>arr[largest]){ largest=r; } if(largest!=i){ int temp =arr[i]; arr[i]=arr[largest]; arr[largest]=temp; heapify(arr,n,largest); } } } void heapsort(int arr[],int n){ for(int i=n/2-1;i>=0;i--){ heapify(arr,n,i); } for(int i=n-1;i>=0;i--){ // swap(arr[0],arr[i]); int temp =arr[0]; arr[0]=arr[i]; arr[i]=temp; cout<<"swap - "<<arr[0]<<" &"<<arr[i]<<endl; heapify(arr,i,0); } } void print(int arr[], int n) { for (int i = 0; i < n; ++i) cout << arr[i] << " "; cout << "\n"; } int main() { cout<<"enter the number of elements you have to sort.."; int n,arr[100]; cin>>n; for(int i=0;i<n;i++){ cout<<"enter the data"<<endl; cin>>arr[i]; } heapsort(arr,n); cout<<"sorted array is : "<<endl; print(arr,n); return 0; }

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.