|
On which hardware, implemented in which language?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Update: the answer to A was wrong and i changed it.
All i know is that it's capped at 1 million operation per second, the rest is unknown to me.
|
|
|
|
|
Member 13133031 wrote: All i know is that it's capped at 1 million operation per second, the rest is unknown to me. You stated in the original question that "size" becomes one million "operations".
SET sum TO 0
FOR i=1 to 10
FOR j=1 to size
sum=sum +1
In that case, the word "operation" is confusing. If you increase the iterations, you'll be executing more instructions.
Since you can count the instructions, you can calculate how long it takes if you know the instructions per second. Shouldn't be too hard to implement this in a BASIC-language and simply see what happens if you change the "size".
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
i have script for encrypt dan decrypt...
Public Shared Function Decrypt(ByRef Msg As String, ByRef Key As String) As String
Dim str As String
Dim builder As New StringBuilder
Try
Dim num5 As Integer = (Msg.Length - 1)
Dim i As Integer = 0
Do While (i <= num5)
Dim num3 As Integer = Strings.Asc(Conversions.ToChar(Msg.Substring(i, 1)))
Dim num2 As Integer = Strings.Asc(MFunction.GetKey(Key, i))
Dim charCode As Integer = (num3 - num2)
builder.Append(Strings.Chr(charCode))
i += 1
Loop
str = builder.ToString
Catch exception1 As Exception
ProjectData.SetProjectError(exception1)
Dim exception As Exception = exception1
Throw New Exception(("Public Function Decrypt(ByRef Msg As String, ByRef Key As String) As String Error : " & ChrW(13) & ChrW(10) & exception.Message.ToString & ChrW(13) & ChrW(10)))
Finally
builder.Length = 0
End Try
Return str
End Function
Public Shared Function Encrypt(ByRef Msg As String, ByRef Key As String) As String
Dim str As String
Dim builder As New StringBuilder
Try
Dim num5 As Integer = (Msg.Length - 1)
Dim i As Integer = 0
Do While (i <= num5)
Dim num3 As Integer = Strings.Asc(Conversions.ToChar(Msg.Substring(i, 1)))
Dim num2 As Integer = Strings.Asc(MFunction.GetKey(Key, i))
Dim charCode As Integer = (num3 + num2)
builder.Append(Strings.Chr(charCode))
i += 1
Loop
str = builder.ToString
Catch exception1 As Exception
ProjectData.SetProjectError(exception1)
Dim exception As Exception = exception1
Throw New Exception(("Public Function Encrypt(ByRef Msg As String, ByRef Key As String) As String Error : " & ChrW(13) & ChrW(10) & exception.Message.ToString & ChrW(13) & ChrW(10)))
Finally
builder.Length = 0
End Try
Return str
End Function
what algorithm is used?
Please advise...
|
|
|
|
|
91191109 wrote: what algorithm is used? It's your code, you tell us.
|
|
|
|
|
Look at MFunction.GetKey(Key, i) - that's what encrypts a single byte.
|
|
|
|
|
91191109 wrote: Dim num3 As Integer = Strings.Asc(Conversions.ToChar(Msg.Substring(i, 1)))
Dim num2 As Integer = Strings.Asc(MFunction.GetKey(Key, i))
Dim charCode As Integer = (num3 + num2)
builder.Append(Strings.Chr(charCode))
Even without seeing the implementation of MFunction.GetKey , it's obvious that this is a variant of the Caesar cipher[^] - possibly a Running key cipher[^].
In other words, an extremely poor algorithm, which will be broken in seconds by a determined hacker.
Unless you are a team of encryption specialists, each with multiple PHDs in the field, then you should never try to implement your own encryption algorithm. There are plenty of perfectly good built-in encryption algorithms; pick one of those instead.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
... and now you've done his homework.
Actually, not sure about the joke icon.
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
How can a find a minimum in right sub tree using recursion
|
|
|
|
|
I'm sorry ... what do you mean ...?
You should give an Example ...
modified 22-Mar-17 9:14am.
|
|
|
|
|
Just recursively trace down the left branches in the right sub tree. The left element is always lowest.
|
|
|
|
|
To begin, I have the set of K values S={v_1, ..., v_K}. I want to pick the smallest value, replace it with another value, and again pick the smallest -- do this K times. So, initially, my best set B is empty, and I want to perform :
Step 1. Find minimum of S. Say it has index n. B=[B, v_n] (i.e., append v_n to B)
Step 2. Update S by replacing v_n with another value (not important how that other value is computed).
Repeat Steps 1 and 2 till B has K values.
I believe a reasonable way to do this is to first construct a min-heap from the initial S (KlogK complexity), and then I can (take out the root + insert new element) for (K-1) times. Assuming taking out root and insertion both are logK complexity, total complexity would be KlogK + 2(K-1)log(K) = (3K-2)logK.
As a next step, once I have the set B, I want to compute some function f(b) for each b in B, and repeat the above procedure with the set {f(b)} instead of the set S. In other words, taking the set {f(b)} as S now, I would like to perform the above described procedure. Brute force way -- I could first use up (3K-2)logK units of time to find B, then compute the set {f(b)}, and then use another (3K-2)logK units of time on {f(b)}. But, it is quite apparent I can do better by pipelining. Essentially, as soon as I start getting entries of B, I can compute f(.) for the available entries, and do some of the sorting operations.
Can you suggest a good/optimal way for the overall problem ?
|
|
|
|
|
i need co-occurrence matrix algorithm in any language. plz share ur results with me.
|
|
|
|
|
|
If you google for it, you will find many examples. Try googling for co occurence matrix python to get started.
This space for rent
|
|
|
|
|
Pete O'Hanlon wrote: co occurence matrix python That's just the Nokia snake game.
|
|
|
|
|
That takes me back. The seconds I wasted on that game
This space for rent
|
|
|
|
|
My wife still has an old phone that she keeps powered up just for that.
|
|
|
|
|
can't able to fine exact code. its confusing
|
|
|
|
|
Part of the art of becoming a programmer is knowing how to search. Paste your search link in as a reply so I can see how you searched.
This space for rent
|
|
|
|
|
|
The search terms I used. Google[^]
This space for rent
|
|
|
|
|
|
thanks but i dont know how to run it. its not giving an error but dont know how to compile it. not giving any output
|
|
|
|
|
The links I found are just to point you to the information that may help you. It is up to you to work out how to use it and, if necessary, find out why it does not work.
|
|
|
|