Skip to content

Instantly share code, notes, and snippets.

View tiwarinaman's full-sized avatar
🎯
Focusing

Naman Kumar tiwarinaman

🎯
Focusing
View GitHub Profile
@tiwarinaman
tiwarinaman / BankManagement.py
Created February 22, 2021 17:46
Python Tkinter Bank Management Systen
import tkinter as tk
from tkinter import messagebox
from time import gmtime, strftime
def is_number(s):
try:
float(s)
return 1
except ValueError:
@tiwarinaman
tiwarinaman / MainActivity.java
Created February 22, 2021 16:03
MainActivity code
package com.techienaman.tictactoe;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
@tiwarinaman
tiwarinaman / activity_main.xml
Created February 22, 2021 15:54
This is UI code for Tic-Tac_Toe
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="20sp"
tools:context=".MainActivity">
<TextView
@tiwarinaman
tiwarinaman / login-portal-tkinter.py
Created August 30, 2020 09:33
Tkinter module login portal
from tkinter import *
import tkinter.messagebox as tkMessageBox
import sqlite3
root = Tk()
root.title("Login Page")
width = 640
height = 480
screen_width = root.winfo_screenwidth()
@tiwarinaman
tiwarinaman / merge-sort.py
Created August 30, 2020 09:26
Merge Sort in python
def mearge_sort(list):
if len(list) > 1:
mid = len(list)//2
left_half = list[:mid]
right_half = list[mid:]
mearge_sort(left_half)
mearge_sort(right_half)
i=j=k=0
while i < len(left_half) and j < len(right_half):
if left_half[i] < right_half[j]:
@tiwarinaman
tiwarinaman / max-heap.py
Created August 30, 2020 09:25
Max Heap
data = [0,85,75,60,30,35,45]
def maxHeapInsert(item):
pos = len(data)
data.insert(pos,item)
print('After inserting the element in the heap')
print(data)
if pos!=0:
while data[int(pos/2) <= item and int(pos/2) >=1]:
data[pos] = data[int(pos/2)]
data[int(pos/2)] = item
@tiwarinaman
tiwarinaman / linkedlist-insertion-and-deletion.py
Created August 30, 2020 09:22
Insertion and deletion in linkedlist
class node:
def __init__(self,data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.start = None
def insertLast(self,value):
@tiwarinaman
tiwarinaman / sort-doubly-linkedlist.py
Created August 30, 2020 09:21
Sorting the doubly linkedlist
class node:
def __init__(self,data):
self.data = data
self.prev = None
self.next = None
class DoublyLinkedList:
def __init__(self):
self.start = None
def insert(self,value):
@tiwarinaman
tiwarinaman / sequential-search.py
Created August 30, 2020 09:19
Sequential search in python
def binary_search(list,data):
for i in list:
if i==data:
print("Data is present")
break
else:
print("Not found")
list=[32,33,41,35,67,54,3,5,44,3,2]
data = int(input('What you want to search :: '))
@tiwarinaman
tiwarinaman / search-linkedlist.py
Created August 30, 2020 09:17
Searching in linkedlist
class node:
def __init__(self,data):
self.data =data
self.next = None
class LinkedList:
def __init__(self):
self.start = None
def inertLast(self,value):