User:Pluke/sandbox

From Wikibooks, open books for an open world
Jump to navigation Jump to search


We have an array of length 10 The array contains multiple words The user inputs a word into the computer The program tells the user at what position the input word lies (“cabbage as position 4”) Or if the word doesn’t appear in the array it returns -1 (“cabbage as position -1”)


What are the given, goals, resources, ownership and constraints on the following problem?

plan a solution and get it to work.

Huffman coding[edit | edit source]

http://www.youtube.com/watch?v=NuAwCbW5Lug Take frequency of inputs and sort it by frequency, most frequent at the top:

output frequency
e 0.5
t 0.2
h 0.2
a 0.07
u 0.02
q 0.01

Then combine the bottom two frequencies and bring the others across:

output frequency
e 0.5 e 0.5
t 0.2 t 0.2
h 0.2 h 0.2
a 0.07 a 0.07
u 0.02 qu 0.03
q 0.01

then combine the next chunk

output frequency
e 0.5 e 0.5
t 0.2 t 0.2
h 0.2 h 0.2
a 0.07 a 0.07 0.1
u 0.02 qu 0.03
q 0.01


Module Glocals
	Dim number1 as integer = 123
	
	Sub Main()
		console.writeline(number1)
		printLocalNumber()
		printGlobalNumber()
	End Sub
	
	Sub printLocalNumber
		Dim number1 as integer = 234
		console.writeline(number1)
	End Sub

	Sub printGlobalNumber
		console.writeline(number1)
	End Sub
End Module