-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #192 from fineanmol/master
pull request
- Loading branch information
Showing
60 changed files
with
1,213 additions
and
6,926 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
*.iml | ||
.git/objects/ | ||
*.class |
Large diffs are not rendered by default.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
Program's_Contributed_By_Contributors/C++_Programs/MajorityElement.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include<bits/stdc++.h> | ||
using namespace std; | ||
|
||
//Finding Majority element in a given vector in O(1) space using Moore's voting algorithm | ||
int majorityElement(vector<int>& v) { | ||
int c1=0; | ||
int ans1=INT_MIN; | ||
for(int i=0;i<v.size();i++) | ||
{ | ||
if(ans1==v[i]) | ||
{ | ||
c1++; | ||
} | ||
else if(ans1==INT_MIN) | ||
{ | ||
c1=1; | ||
ans1=v[i]; | ||
} | ||
else | ||
{ | ||
c1--; | ||
if(c1==0) ans1=INT_MIN; | ||
} | ||
} | ||
return ans1; | ||
} | ||
|
||
int main() | ||
{ | ||
//input vector | ||
int n; | ||
cin>>n; | ||
vector<int> v(n); | ||
for(int i=0;i<n;i++) | ||
cin>>v[i]; | ||
int ans=majorityElement(v); | ||
cout<<ans<<endl; | ||
} |
53 changes: 53 additions & 0 deletions
53
Program's_Contributed_By_Contributors/C++_Programs/QuickSort.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#include<bits/stdc++.h> | ||
using namespace std; | ||
int partition(int *a,int start,int end) | ||
{ | ||
int pivot=a[end]; | ||
|
||
int P_index=start; | ||
int i,t; | ||
|
||
for(i=start;i<end;i++) | ||
{ | ||
if(a[i]<=pivot) | ||
{ | ||
t=a[i]; | ||
a[i]=a[P_index]; | ||
a[P_index]=t; | ||
P_index++; | ||
} | ||
} | ||
t=a[end]; | ||
a[end]=a[P_index]; | ||
a[P_index]=t; | ||
|
||
return P_index; | ||
} | ||
void Quicksort(int *a,int start,int end) | ||
{ | ||
if(start<end) | ||
{ | ||
int P_index=partition(a,start,end); | ||
Quicksort(a,start,P_index-1); | ||
Quicksort(a,P_index+1,end); | ||
} | ||
} | ||
int main() | ||
{ | ||
int n; | ||
cout<<"Enter number of elements: "; | ||
cin>>n; | ||
int a[n]; | ||
cout<<"Enter the array elements:\n"; | ||
for(int i=0;i<n;i++) | ||
{ | ||
cin>>a[i]; | ||
} | ||
Quicksort(a,0,n-1); | ||
cout<<"After Quick Sort the array is:\n"; | ||
for(int i=0;i<n;i++) | ||
{ | ||
cout<<a[i]<<" "; | ||
} | ||
return 0; | ||
} |
94 changes: 94 additions & 0 deletions
94
Program's_Contributed_By_Contributors/C++_Programs/dijikstra.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// A C++ program for Dijkstra's single source shortest path algorithm. | ||
// The program is for adjacency matrix representation of the graph | ||
#include <iostream> | ||
using namespace std; | ||
#include <limits.h> | ||
|
||
// Number of vertices in the graph | ||
#define V 9 | ||
|
||
// A utility function to find the vertex with minimum distance value, from | ||
// the set of vertices not yet included in shortest path tree | ||
int minDistance(int dist[], bool sptSet[]) | ||
{ | ||
|
||
// Initialize min value | ||
int min = INT_MAX, min_index; | ||
|
||
for (int v = 0; v < V; v++) | ||
if (sptSet[v] == false && dist[v] <= min) | ||
min = dist[v], min_index = v; | ||
|
||
return min_index; | ||
} | ||
|
||
// A utility function to print the constructed distance array | ||
void printSolution(int dist[]) | ||
{ | ||
cout << "Vertex \t Distance from Source" << endl; | ||
for (int i = 0; i < V; i++) | ||
cout << i << " \t\t" << dist[i] << endl; | ||
} | ||
|
||
// Function that implements Dijkstra's single source shortest path algorithm | ||
// for a graph represented using adjacency matrix representation | ||
void dijkstra(int graph[V][V], int src) | ||
{ | ||
int dist[V]; // The output array. dist[i] will hold the shortest | ||
// distance from src to i | ||
|
||
bool sptSet[V]; // sptSet[i] will be true if vertex i is included in shortest | ||
// path tree or shortest distance from src to i is finalized | ||
|
||
// Initialize all distances as INFINITE and stpSet[] as false | ||
for (int i = 0; i < V; i++) | ||
dist[i] = INT_MAX, sptSet[i] = false; | ||
|
||
// Distance of source vertex from itself is always 0 | ||
dist[src] = 0; | ||
|
||
// Find shortest path for all vertices | ||
for (int count = 0; count < V - 1; count++) | ||
{ | ||
// Pick the minimum distance vertex from the set of vertices not | ||
// yet processed. u is always equal to src in the first iteration. | ||
int u = minDistance(dist, sptSet); | ||
|
||
// Mark the picked vertex as processed | ||
sptSet[u] = true; | ||
|
||
// Update dist value of the adjacent vertices of the picked vertex. | ||
for (int v = 0; v < V; v++) | ||
|
||
// Update dist[v] only if is not in sptSet, there is an edge from | ||
// u to v, and total weight of path from src to v through u is | ||
// smaller than current value of dist[v] | ||
if (!sptSet[v] && graph[u][v] && dist[u] != INT_MAX && dist[u] + graph[u][v] < dist[v]) | ||
dist[v] = dist[u] + graph[u][v]; | ||
} | ||
|
||
// print the constructed distance array | ||
printSolution(dist); | ||
} | ||
|
||
// driver program to test above function | ||
int main() | ||
{ | ||
|
||
/* Let us create the example graph discussed above */ | ||
int graph[V][V] = {{0, 4, 0, 0, 0, 0, 0, 8, 0}, | ||
{4, 0, 8, 0, 0, 0, 0, 11, 0}, | ||
{0, 8, 0, 7, 0, 4, 0, 0, 2}, | ||
{0, 0, 7, 0, 9, 14, 0, 0, 0}, | ||
{0, 0, 0, 9, 0, 10, 0, 0, 0}, | ||
{0, 0, 4, 14, 10, 0, 2, 0, 0}, | ||
{0, 0, 0, 0, 0, 2, 0, 1, 6}, | ||
{8, 11, 0, 0, 0, 0, 1, 0, 7}, | ||
{0, 0, 2, 0, 0, 0, 6, 7, 0}}; | ||
|
||
dijkstra(graph, 0); | ||
|
||
return 0; | ||
} | ||
|
||
// This code is contributed by shivanisinghss2110 |
55 changes: 55 additions & 0 deletions
55
Program's_Contributed_By_Contributors/HTML Designs/jiit.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Responsive</title> | ||
<link rel="stylesheet" href="css/rss.css"> | ||
</head> | ||
<body> | ||
<header> | ||
<h1> Jaypee Institute of Information Technology, Noida</h1> | ||
<nav> | ||
<a href="http://www.umich.edu/">University of Michigan</a> | ||
<a href="http://www.intro-webdesign.com/">Intro to Web Design</a> | ||
</nav> | ||
</header> | ||
|
||
|
||
<section id = "left"> | ||
<h2>Admissions 2021</h2> | ||
<ul> | ||
<li>B.Tech (JEE & 10+2 Based)</li> | ||
<li>B.Tech Lateral Entry</li> | ||
<li>M.Tech</li> | ||
<li>Integrated M.Tech</li> | ||
<li>BBA</li> | ||
<li>MBA</li> | ||
<li>Ph.D</li> | ||
</ul> | ||
</section> | ||
|
||
|
||
<section id = "center"> | ||
<h2>Why I am at University of Michigan</h2> | ||
<div class="myClass"> | ||
<h3> Ann Arbor</h3> | ||
<p >There are many excellent reason to attend the <a href = "umich.edu">University of Michigan</a>. The academics are top-notch, the students are exceptionally good-looking, and for about six weeks out of the year the weather is almost pleasant.</p> | ||
</div> | ||
|
||
<div> | ||
<img src="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTO8WIJ5ygVENopHPC5Op9z4ua-MoGD-LoUZuEd6vdL-EMro28CWw" alt="Football"> | ||
|
||
<img src="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTO8WIJ5ygVENopHPC5Op9z4ua-MoGD-LoUZuEd6vdL-EMro28CWw" alt="Solar Car"> | ||
|
||
<img src="http://www-personal.umich.edu/~jensenl/visuals/album/annarbor/IMG_1051.jpg" alt="campus"> | ||
|
||
<img src="http://www-personal.umich.edu/~jensenl/visuals/album/annarbor/IMG_1051.jpg" alt="campus" alt="Football"> | ||
</div> | ||
</section> | ||
|
||
|
||
<footer> | ||
<p>Sample code for Responsive Design .<br/> Colleen van Lent</p> | ||
</footer> | ||
</body> | ||
</html> |
86 changes: 86 additions & 0 deletions
86
Program's_Contributed_By_Contributors/HTML Designs/rssboot.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<!-- | ||
Style the page as it appears in the example. --> | ||
<!-- DO NOT CHANGE ANY PART OF THIS HTML CODE!!! --> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<title>Responsive</title> | ||
<!-- CSS only --> | ||
|
||
<!-- CSS only --> | ||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous"> | ||
|
||
<!-- JS, Popper.js, and jQuery --> | ||
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script> | ||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script> | ||
|
||
<link rel="stylesheet" href="css/rssboot.css"> | ||
</head> | ||
<body > | ||
<header class="col-xs-12 col-sm-12 d-md-none d-lg-none d-xl-none"> | ||
<p class="d-none d-print-block">Web Design is Awesome!!!(I guess...)</p> | ||
<h1 class="d-print-none d-md-none d-lg-none d-xl-none"> Web Design is Awesome!!!</h1> | ||
<h1 class="d-print-none d-none d-md-block d-lg-block d-xl-block"> Web Design is Awesome!!!(I guess...)</h1> | ||
<nav> | ||
<a href="http://www.umich.edu/">University of Michigan</a> | ||
<a href="http://www.intro-webdesign.com/">Intro to Web Design</a> | ||
</nav> | ||
</header> | ||
<header class=" col-md-12 col-lg-12 col-xl-12 d-none d-md-block d-lg-block d-xl-block"> | ||
<p class="d-none d-print-block">Web Design is Awesome!!!(I guess...)</p> | ||
<h1 class="d-print-none d-md-none d-lg-none d-xl-none"> Web Design is Awesome!!!</h1> | ||
<h1 class="d-print-none d-none d-md-block d-lg-block d-xl-block"> Web Design is Awesome!!!(I guess...)</h1> | ||
<nav> | ||
<a href="http://www.umich.edu/">University of Michigan</a> | ||
<a href="http://www.intro-webdesign.com/">Intro to Web Design</a> | ||
</nav> | ||
</header> | ||
|
||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-md-4 col-lg-3 d-print-block"> | ||
<h2>Why I am taking this class</h2> | ||
<ol> | ||
<li>It is required.</li> | ||
<li>I already know it, easy A!</li> | ||
<li>My mom wants a webpage.</li> | ||
</ol> | ||
</div> | ||
|
||
|
||
<div class="col-md-7 col-lg-8 d-print-block"> | ||
<h2>Why I am at University of Michigan</h2> | ||
<div class="myClass"> | ||
<h3> Ann Arbor</h3> | ||
<p >There are many excellent reason to attend the <a href = "umich.edu">University of Michigan</a>. The academics are top-notch, the students are exceptionally good-looking, and for about six weeks out of the year the weather is almost pleasant.</p> | ||
</div> | ||
</div> | ||
<div class="col-md-3 col-lg-4" ></div> | ||
<div class="d-none d-print-none d-md-block d-lg-block d-xl-block col-md-9 col-lg-8"> | ||
<img src="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTO8WIJ5ygVENopHPC5Op9z4ua-MoGD-LoUZuEd6vdL-EMro28CWw" alt="Football"> | ||
|
||
|
||
<img src="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTO8WIJ5ygVENopHPC5Op9z4ua-MoGD-LoUZuEd6vdL-EMro28CWw" alt="Solar Car"> | ||
|
||
|
||
<img src="http://www-personal.umich.edu/~jensenl/visuals/album/annarbor/IMG_1051.jpg" alt="campus"> | ||
|
||
|
||
<img src="http://www-personal.umich.edu/~jensenl/visuals/album/annarbor/IMG_1051.jpg" alt="campus" alt="Football"> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
<footer class="col-xs-12 col-sm-12 d-md-none d-lg-none d-xl-none"> | ||
<p>Sample code for Responsive Design .<br/> Colleen van Lent</p> | ||
</footer> | ||
<footer class="d-print-none col-md-12 col-lg-12 col-xl-12 d-none d-md-block d-lg-block d-xl-block"> | ||
<p>Sample code for Responsive Design .<br/> Colleen van Lent</p> | ||
</footer> | ||
<!-- DO NOT CHANGE ANY PART OF THIS HTML CODE!!! --> | ||
</body> | ||
</html> |
Oops, something went wrong.