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
def swap(p,q): | |
return q,p | |
a=[] | |
x=int(input("Enter the number of elements you want to sort : ")) | |
i=0 | |
while (i < x): | |
y=int(input("Enter element " + str(i+1) + " : ")) | |
a.append(y) |
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
a = [] | |
#Function to accept reference string and frame size. | |
def accept(): | |
global a,n,m | |
n = input("\n Enter the size of reference string : ") | |
for i in range(n): | |
a.append(input(" Enter [%2d] : " % (i+1))) | |
m = input("\n Enter page frame size : ") |
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
#include<stdio.h> | |
#include<stdlib.h> | |
typedef struct process{ | |
char name[5]; | |
int bt; | |
int at; | |
int prt; | |
int wt,ta; | |
int flag; |
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
#include<stdio.h> | |
#include<stdlib.h> | |
void print(int x[][10],int n,int m){ | |
int i,j; | |
for(i=0;i<n;i++){ | |
printf("\n"); | |
for(j=0;j<m;j++){ | |
printf("%d\t",x[i][j]); | |
} |
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
#include<stdio.h> | |
#include<stdlib.h> | |
typedef struct process{ | |
int psize; | |
int pflag; | |
}process; | |
typedef struct block{ | |
int bsize; |
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
/* | |
THREAD MANAGEMENT USING PTHREAD LIBRARY | |
Implement matrix multiplication using multithreading. Application should | |
have pthread_create, pthread_join, pthread_exit. In the program, every | |
thread must return the value and must be collected in pthread_join in the | |
main function. Final sum of row-column multiplication must be done by main | |
thread (main function). | |
*/ |
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
class Node(object): | |
def __init__(self, value, left, right): | |
self.value = value | |
self.left = left | |
self.right = right | |
def find(root, target): | |
if root is None: | |
return None | |
if root.value == target: |
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
import os | |
def generate_directory_tree(dir_path): | |
paths = [] | |
for root, _, files in os.walk(dir_path): | |
paths.append(root) | |
paths.extend(os.path.join(root, _file) for _file in files) | |
return paths |
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
import pygtrie | |
# 0 denotes a directory and 1 denotes a file | |
path_entries = [ | |
("./pcache/pcache.egg-info/dependency_links.txt", 1), | |
("./pcache/LICENSE", 1), | |
("./pcache/build/lib/pcache/__init__.py", 1), | |
("./pcache/pcache.egg-info/top_level.txt", 1), | |
("./pcache/pcache/pcache.py", 1), | |
("./pcache/pcache/__init__.py", 1), |
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
from hashlib import sha256 | |
class Node: | |
"""A Merkle tree node | |
Stores the computed hash and the parent of the node | |
Args: | |
hash: Hash of the (left + right) children |
OlderNewer