mrmiyagi
mrmiyagi
CC#
Created by mrmiyagi on 3/9/2024 in #help
simple algorithm question
FUNCTION CountX(t: Tree; x: INTEGER): INTEGER
BEGIN
IF t = NIL THEN
CountX:= 0;
ELSE IF t^.val = x THEN
CountX:= 1;
ELSE
CountX:= CountX(t^.left; x) + CountX(t^.left; x);
END;
FUNCTION CountX(t: Tree; x: INTEGER): INTEGER
BEGIN
IF t = NIL THEN
CountX:= 0;
ELSE IF t^.val = x THEN
CountX:= 1;
ELSE
CountX:= CountX(t^.left; x) + CountX(t^.left; x);
END;
Quick question: In this function lets say that the "else if" comes true in the first node. wouldnt it just skip the "else" and give out CountX = 1 ? so in order to solve that, my recursive call should not be bound by that "else" and should be done anyway (the code is pascal, but that shouldnt matter with this simple algorithm)
3 replies
CC#
Created by mrmiyagi on 10/15/2023 in #help
❔ PASCAL While Statement
No description
19 replies
CC#
Created by mrmiyagi on 10/10/2023 in #help
❔ DateTime?
CreationTimestamp = reader.GetDateTime(04),
TransmissionTimestamp = reader.IsDBNull(09) ? (DateTime?)null : reader.GetDateTime(09),
.
.
.
.
sb.Append($"(to_timestamp('{this.CreationTimestamp.ToLocalTime():yyyy-MM-dd HH:mm:ss}', 'YYYY-MM-DD HH24:MI:SS'), to_timestamp('{this.TransmissionTimestamp.ToLocalTime():yyyy-MM-dd HH:mm:ss}', 'YYYY-MM-DD HH24:MI:SS');");
CreationTimestamp = reader.GetDateTime(04),
TransmissionTimestamp = reader.IsDBNull(09) ? (DateTime?)null : reader.GetDateTime(09),
.
.
.
.
sb.Append($"(to_timestamp('{this.CreationTimestamp.ToLocalTime():yyyy-MM-dd HH:mm:ss}', 'YYYY-MM-DD HH24:MI:SS'), to_timestamp('{this.TransmissionTimestamp.ToLocalTime():yyyy-MM-dd HH:mm:ss}', 'YYYY-MM-DD HH24:MI:SS');");
I am trying to convert both of these dates to local time. It works CreationTimestamp but not for TransmissionTimestamp. The error given is something along the line of: "DateTime? doesnt have any reference to ToLocalTime".
13 replies