Skip to content

Commit 3978103

Browse files
committed
added quick sort in C#
1 parent 63e5087 commit 3978103

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+335
-470
lines changed

Data Structures/Stack/C++/Test/test

100755100644
File mode changed.

Data Structures/Stack/Python/stack.py

+38-38
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
2-
3-
class Stack:
4-
5-
def __init__(self, size = 1000000):
6-
self.stack = []
7-
self.stack_size = size
8-
9-
# Add element to stack
10-
def push(self, element):
11-
# Checking stack is full or not
12-
if len(self.stack) <= self.stack_size:
13-
self.stack.append(element)
14-
else:
15-
print('Stack Full. Overflow')
16-
17-
# Delete element from stack
18-
def pop(self):
19-
if len(self.stack) == 0:
20-
print('Empty Stack. Underflow')
21-
else:
22-
self.stack.pop()
23-
24-
# Returns top element of stack
25-
def top(self):
26-
return self.stack[-1]
27-
28-
29-
# Driver Program
30-
if __name__ == '__main__':
31-
stack = Stack()
32-
stack.pop()
33-
stack.push(1)
34-
stack.push(2)
35-
stack.push(3)
36-
print(stack.top())
37-
stack.pop()
38-
print(stack.top())
1+
2+
3+
class Stack:
4+
5+
def __init__(self, size = 1000000):
6+
self.stack = []
7+
self.stack_size = size
8+
9+
# Add element to stack
10+
def push(self, element):
11+
# Checking stack is full or not
12+
if len(self.stack) <= self.stack_size:
13+
self.stack.append(element)
14+
else:
15+
print('Stack Full. Overflow')
16+
17+
# Delete element from stack
18+
def pop(self):
19+
if len(self.stack) == 0:
20+
print('Empty Stack. Underflow')
21+
else:
22+
self.stack.pop()
23+
24+
# Returns top element of stack
25+
def top(self):
26+
return self.stack[-1]
27+
28+
29+
# Driver Program
30+
if __name__ == '__main__':
31+
stack = Stack()
32+
stack.pop()
33+
stack.push(1)
34+
stack.push(2)
35+
stack.push(3)
36+
print(stack.top())
37+
stack.pop()
38+
print(stack.top())
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
# Program to display the Fibonacci sequence up to n-th term where n is provided by the user
2-
3-
# change this value for a different result
4-
nterms = int (input("enter the no. of terms " ))
5-
6-
# uncomment to take input from the user
7-
#nterms = int(input("How many terms? "))
8-
9-
# first two terms
10-
n1 = 0
11-
n2 = 1
12-
count = 0
13-
14-
# check if the number of terms is valid
15-
if nterms <= 0:
16-
print("Please enter a positive integer")
17-
elif nterms == 1:
18-
print("Fibonacci sequence upto",nterms,":")
19-
print(n1)
20-
else:
21-
print("Fibonacci sequence upto",nterms,":")
22-
while count < nterms:
23-
print(n1,end=' , ')
24-
nth = n1 + n2
25-
# update values
26-
n1 = n2
27-
n2 = nth
28-
count += 1
1+
# Program to display the Fibonacci sequence up to n-th term where n is provided by the user
2+
3+
# change this value for a different result
4+
nterms = int (input("enter the no. of terms " ))
5+
6+
# uncomment to take input from the user
7+
#nterms = int(input("How many terms? "))
8+
9+
# first two terms
10+
n1 = 0
11+
n2 = 1
12+
count = 0
13+
14+
# check if the number of terms is valid
15+
if nterms <= 0:
16+
print("Please enter a positive integer")
17+
elif nterms == 1:
18+
print("Fibonacci sequence upto",nterms,":")
19+
print(n1)
20+
else:
21+
print("Fibonacci sequence upto",nterms,":")
22+
while count < nterms:
23+
print(n1,end=' , ')
24+
nth = n1 + n2
25+
# update values
26+
n1 = n2
27+
n2 = nth
28+
count += 1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
4 4
2-
2 3 3 3
3-
1 3 2 3
4-
2 2 1 2
5-
1 2 1 1
1+
4 4
2+
2 3 3 3
3+
1 3 2 3
4+
2 2 1 2
5+
1 2 1 1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
4 5
2-
1 1 2 2 1
3-
1 3 1 1 1
4-
3 3 1 3 3
5-
0 0 3 2 0
1+
4 5
2+
1 1 2 2 1
3+
1 3 1 1 1
4+
3 3 1 3 3
5+
0 0 3 2 0
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
4 5
2-
1 2 1 3 1
3-
2 2 3 3 1
4-
2 1 3 0 3
5-
1 1 1 0 2
1+
4 5
2+
1 2 1 3 1
3+
2 2 3 3 1
4+
2 1 3 0 3
5+
1 1 1 0 2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
4 5
2-
2 3 1 3 1
3-
3 1 2 2 2
4-
2 3 1 3 2
5-
1 3 2 1 0
1+
4 5
2+
2 3 1 3 1
3+
3 1 2 2 2
4+
2 3 1 3 2
5+
1 3 2 1 0
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
4 5
2-
3 1 2 2 1
3-
1 2 2 2 1
4-
1 2 1 1 3
5-
3 1 3 3 2
1+
4 5
2+
3 1 2 2 1
3+
1 2 2 2 1
4+
1 2 1 1 3
5+
3 1 3 3 2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
5 5
2-
2 3 3 3 2
3-
2 3 2 3 2
4-
0 1 2 2 2
5-
0 2 2 1 1
6-
0 1 0 3 1
1+
5 5
2+
2 3 3 3 2
3+
2 3 2 3 2
4+
0 1 2 2 2
5+
0 2 2 1 1
6+
0 1 0 3 1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
4 6
2-
1 3 2 3 3 0
3-
3 2 2 3 1 3
4-
1 2 2 3 2 0
5-
1 2 1 3 3 2
1+
4 6
2+
1 3 2 3 3 0
3+
3 2 2 3 1 3
4+
1 2 2 3 2 0
5+
1 2 1 3 3 2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
3 8
2-
1 3 3 1 1 1 1 0
3-
1 3 2 2 1 1 2 3
4-
3 2 2 2 3 2 1 1
1+
3 8
2+
1 3 3 1 1 1 1 0
3+
1 3 2 2 1 1 2 3
4+
3 2 2 2 3 2 1 1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
3 8
2-
3 3 3 3 1 3 1 3
3-
2 2 2 1 3 3 1 0
4-
1 3 2 3 3 1 1 2
1+
3 8
2+
3 3 3 3 1 3 1 3
3+
2 2 2 1 3 3 1 0
4+
1 3 2 3 3 1 1 2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
2 3
2-
0 0 3
3-
2 3 3
1+
2 3
2+
0 0 3
3+
2 3 3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
4 4
2-
1 0 0 0
3-
2 3 2 1
4-
2 2 2 1
5-
2 2 2 2
1+
4 4
2+
1 0 0 0
3+
2 3 2 1
4+
2 2 2 1
5+
2 2 2 2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
4 4
2-
2 1 3 3
3-
0 3 3 1
4-
0 3 1 2
5-
1 2 1 1
1+
4 4
2+
2 1 3 3
3+
0 3 3 1
4+
0 3 1 2
5+
1 2 1 1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
4 4
2-
1 1 1 3
3-
1 2 2 2
4-
2 2 1 1
5-
2 2 1 0
1+
4 4
2+
1 1 1 3
3+
1 2 2 2
4+
2 2 1 1
5+
2 2 1 0
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
4 4
2-
1 2 1 3
3-
2 3 2 1
4-
2 2 1 3
5-
2 3 3 2
1+
4 4
2+
1 2 1 3
3+
2 3 2 1
4+
2 2 1 3
5+
2 3 3 2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
4 5
2-
2 0 2 0 2
3-
3 3 1 1 3
4-
3 2 3 3 3
5-
3 3 3 2 0
1+
4 5
2+
2 0 2 0 2
3+
3 3 1 1 3
4+
3 2 3 3 3
5+
3 3 3 2 0
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
4 5
2-
1 1 2 2 1
3-
3 2 3 1 3
4-
0 3 3 1 3
5-
2 1 1 2 0
1+
4 5
2+
1 1 2 2 1
3+
3 2 3 1 3
4+
0 3 3 1 3
5+
2 1 1 2 0
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
3 8
2-
0 1 3 1 1 2 2 2
3-
0 2 2 3 1 1 1 2
4-
0 0 0 2 1 2 1 1
1+
3 8
2+
0 1 3 1 1 2 2 2
3+
0 2 2 3 1 1 1 2
4+
0 0 0 2 1 2 1 1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
2 11
2-
1 1 1 2 3 2 2 2 1 0 0
3-
2 1 1 3 2 2 3 3 3 3 2
1+
2 11
2+
1 1 1 2 3 2 2 2 1 0 0
3+
2 1 1 3 2 2 3 3 3 3 2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
2 11
2-
0 2 1 3 2 1 1 1 1 3 3
3-
2 3 2 2 2 2 3 3 3 1 2
1+
2 11
2+
0 2 1 3 2 1 1 1 1 3 3
3+
2 3 2 2 2 2 3 3 3 1 2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
2 3
2-
0 0 3
3-
2 3 3
1+
2 3
2+
0 0 3
3+
2 3 3

Fibonacci_series.py

+28-28
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
# Program to display the Fibonacci sequence up to n-th term where n is provided by the user
2-
3-
# change this value for a different result
4-
nterms = int (input("enter the no. of terms " ))
5-
6-
# uncomment to take input from the user
7-
#nterms = int(input("How many terms? "))
8-
9-
# first two terms
10-
n1 = 0
11-
n2 = 1
12-
count = 0
13-
14-
# check if the number of terms is valid
15-
if nterms <= 0:
16-
print("Please enter a positive integer")
17-
elif nterms == 1:
18-
print("Fibonacci sequence upto",nterms,":")
19-
print(n1)
20-
else:
21-
print("Fibonacci sequence upto",nterms,":")
22-
while count < nterms:
23-
print(n1,end=' , ')
24-
nth = n1 + n2
25-
# update values
26-
n1 = n2
27-
n2 = nth
28-
count += 1
1+
# Program to display the Fibonacci sequence up to n-th term where n is provided by the user
2+
3+
# change this value for a different result
4+
nterms = int (input("enter the no. of terms " ))
5+
6+
# uncomment to take input from the user
7+
#nterms = int(input("How many terms? "))
8+
9+
# first two terms
10+
n1 = 0
11+
n2 = 1
12+
count = 0
13+
14+
# check if the number of terms is valid
15+
if nterms <= 0:
16+
print("Please enter a positive integer")
17+
elif nterms == 1:
18+
print("Fibonacci sequence upto",nterms,":")
19+
print(n1)
20+
else:
21+
print("Fibonacci sequence upto",nterms,":")
22+
while count < nterms:
23+
print(n1,end=' , ')
24+
nth = n1 + n2
25+
# update values
26+
n1 = n2
27+
n2 = nth
28+
count += 1

Java Design Patterns/AbstractFactory/App.java

100755100644
File mode changed.

Java Design Patterns/AbstractFactory/FactoryCar.java

100755100644
File mode changed.

Java Design Patterns/AbstractFactory/GMCFactory.java

100755100644
File mode changed.

Java Design Patterns/AbstractFactory/Minivan.java

100755100644
File mode changed.

Java Design Patterns/AbstractFactory/Pickup.java

100755100644
File mode changed.

Java Design Patterns/AbstractFactory/Savana.java

100755100644
File mode changed.

Java Design Patterns/AbstractFactory/Sienna.java

100755100644
File mode changed.

Java Design Patterns/AbstractFactory/Sierra.java

100755100644
File mode changed.

Java Design Patterns/AbstractFactory/Tacoma.java

100755100644
File mode changed.

Java Design Patterns/AbstractFactory/ToyotaFactory.java

100755100644
File mode changed.

Java Design Patterns/AbstractFactory/readme.md

100755100644
File mode changed.

0 commit comments

Comments
 (0)