Welcome
Welcome to Source Coders. This blog mainly aims at Computer Science and Engineering students who wish to aspire more about their field and acquire more knowledge. You'll surely get something here. The study materials given in this blog are based on MG University Computer Science and Engineering syllabus.
The study materials in this page are not my creations. Thanks to those who compiled it and I don't know exactly whom to thank.
Labels
- Advanced Microprocessor and Peripherals (1)
- Advanced Software Environments (1)
- Algorithm Analysis and Design (4)
- Artificial Intelligence (2)
- Biometrics (2)
- Client Server Computing (1)
- Computer Graphics (1)
- Computer Networks (1)
- Data Communication (2)
- Data Structures (1)
- Database Management System (2)
- Engineering Mathematics (1)
- File Structure and Algorithms (1)
- Image Processing (1)
- Integrated Circuits (1)
- Java (1)
- Language Processors (2)
- Linux (2)
- Logic System Design (1)
- Network Computing (1)
- Object Oriented Modelling and Design (1)
- Object Oriented Programming (1)
- Octave (1)
- OpenCV (1)
- Operating Systems (2)
- PL/SQL (1)
- Presentations (1)
- Principles of Programming Languages (2)
- Programming Languages (4)
- Project Management and Quality Assurance (1)
- Python (4)
- Python Codes (3)
- Question Papers (3)
- Security in Computing (1)
- Semester 8 (1)
- Software Engineering (2)
- Study Materials (30)
- Theory of Computation (1)
- Ubuntu (2)
- Video Processing (1)
- Web Technologies (1)
Posted by
angelheart
Thursday, April 19, 2012
comments (0)
Labels:
Network Computing,
Study Materials
Posted by
angelheart
Sunday, April 15, 2012
# Tower of Hanoi problem
def TowerOfHanoi(src, dest, intr, n):
if n > 0:
TowerOfHanoi(src, intr, dest, n-1)
print "Move ", src, " to ", dest
TowerOfHanoi(intr, dest, src, n-1)
n = input("Enter the number of discs : ");
TowerOfHanoi('A', 'B', 'C', n)
def TowerOfHanoi(src, dest, intr, n):
if n > 0:
TowerOfHanoi(src, intr, dest, n-1)
print "Move ", src, " to ", dest
TowerOfHanoi(intr, dest, src, n-1)
n = input("Enter the number of discs : ");
TowerOfHanoi('A', 'B', 'C', n)
Posted by
angelheart
# Prims algorithm
from collections import defaultdict
from heapq import *
def prim( nodes, edges ):
conn = defaultdict( list )
for n1,n2,c in edges:
conn[ n1 ].append( (c, n1, n2) )
conn[ n2 ].append( (c, n2, n1) )
mst = []
used = set( nodes[ 0 ] )
usable_edges = conn[ nodes[0] ][:]
heapify( usable_edges )
while usable_edges:
cost, n1, n2 = heappop( usable_edges )
if n2 not in used:
used.add( n2 )
mst.append( ( n1, n2, cost ) )
for e in conn[ n2 ]:
if e[ 2 ] not in used:
heappush( usable_edges, e )
return mst
#test
nodes = list("ABCDEFG")
edges = [ ("A", "B", 7), ("A", "D", 5),
("B", "C", 8), ("B", "D", 9),
("B", "E", 7), ("C", "E", 5),
("D", "E", 15), ("D", "F", 6),
("E", "F", 8), ("E", "G", 9),
("F", "G", 11)]
print "prim:", prim( nodes, edges )
from collections import defaultdict
from heapq import *
def prim( nodes, edges ):
conn = defaultdict( list )
for n1,n2,c in edges:
conn[ n1 ].append( (c, n1, n2) )
conn[ n2 ].append( (c, n2, n1) )
mst = []
used = set( nodes[ 0 ] )
usable_edges = conn[ nodes[0] ][:]
heapify( usable_edges )
while usable_edges:
cost, n1, n2 = heappop( usable_edges )
if n2 not in used:
used.add( n2 )
mst.append( ( n1, n2, cost ) )
for e in conn[ n2 ]:
if e[ 2 ] not in used:
heappush( usable_edges, e )
return mst
#test
nodes = list("ABCDEFG")
edges = [ ("A", "B", 7), ("A", "D", 5),
("B", "C", 8), ("B", "D", 9),
("B", "E", 7), ("C", "E", 5),
("D", "E", 15), ("D", "F", 6),
("E", "F", 8), ("E", "G", 9),
("F", "G", 11)]
print "prim:", prim( nodes, edges )
Posted by
angelheart
#N Queens problem using Backtracking
x = {}
def nqueen(k, n):
for i in range(1, n+1):
if place(k, i):
x[k] = i
if k == n:
print x
else:
nqueen(k+1, n)
def place(row, col):
for j in range(1, row):
if x[j] == col or abs(j-row) == abs(x[j]-col):
return False
return True
n = input("Enter the number of queens : ")
nqueen(1, n)
x = {}
def nqueen(k, n):
for i in range(1, n+1):
if place(k, i):
x[k] = i
if k == n:
print x
else:
nqueen(k+1, n)
def place(row, col):
for j in range(1, row):
if x[j] == col or abs(j-row) == abs(x[j]-col):
return False
return True
n = input("Enter the number of queens : ")
nqueen(1, n)
Posted by
angelheart
Monday, March 26, 2012
OpenCV is an open source computer vision library originally developed by Intel. It is free for commercial and research use under a BSD license. The library is cross-platform, and runs on Mac OS X, Windows and Linux. It focuses mainly towards real-time image processing, as such, if it finds Intel's Integrated Performance Primitives on the system, it will use these commercial optimized routines to accelerate itself.
OpenCV (Web Link 1)
OpenCV Tutorials (Web Link 2)
Posted by
angelheart
Sunday, January 22, 2012
GNU Octave is a high-level language, primarily intended for numerical computations. It provides a convenient interactive command line interface for solving linear and nonlinear problems numerically, and for performing other numerical experiments. It may also be used as a batch-oriented language for data processing.
GNU Octave (Web Link)
Octave Programming Tutorial (Web Link 1)
Octave Programming Tutorial (Web Link 2)
GNU Octave (Web Link)
Octave Programming Tutorial (Web Link 1)
Octave Programming Tutorial (Web Link 2)
Subscribe to:
Posts (Atom)