Algorithm 编写基本伪代码时出现问题

Algorithm 编写基本伪代码时出现问题,algorithm,pseudocode,Algorithm,Pseudocode,我需要帮助写一些基本的伪代码 我有一个数据集,包含出租车出行的开始和结束时间(分钟)(end\u time,start\u time)。我需要帮助编写一些伪代码来计算这些行程中有多少超过1小时 持续时间一次读取一个,并且只应在到达文件末尾之前读取。让我们通过一个示例尝试为上述问题编写一个算法 假设有一个文件包含5条目end\u time和start\u time,如下所示:- 1. 09:00 am - 10:05 am 2. 11:00 am - 11:15 am 3. 12:00 pm

我需要帮助写一些基本的伪代码

我有一个数据集,包含出租车出行的开始和结束时间(分钟)(
end\u time
start\u time
)。我需要帮助编写一些伪代码来计算这些行程中有多少超过1小时


持续时间
一次读取一个,并且只应在到达文件末尾之前读取。

让我们通过一个示例尝试为上述问题编写一个算法

假设有一个文件包含
5
条目
end\u time
start\u time
,如下所示:-

1. 09:00 am - 10:05 am
2. 11:00 am - 11:15 am  
3. 12:00 pm - 12:30 pm
4. 15:00 pm - 18:00 pm
5. 07:00 am - 07:10 am
Step 1. Load the file which has data. Also create a global variable to store count and initialize it to zero.
Step 2. Start Reading the file line by line and store each line in a temporary variable.
Step 3. Parse the line i.e split the line in the above example based on ' ' (space).
Step 4. Once we get the start and end time while parsing the line, calculate the time difference and store this difference in a variable called diff_time.
Step 5. if (diff_time > 1 hour) { count++; }
Step 6. Print the count.
由于这篇文章没有提供样本数据,我假设数据看起来与我上面写的类似,
第一次
是我们的
开始时间
第二次
是我们的
结束时间

现在我们的算法看起来像这样:-

1. 09:00 am - 10:05 am
2. 11:00 am - 11:15 am  
3. 12:00 pm - 12:30 pm
4. 15:00 pm - 18:00 pm
5. 07:00 am - 07:10 am
Step 1. Load the file which has data. Also create a global variable to store count and initialize it to zero.
Step 2. Start Reading the file line by line and store each line in a temporary variable.
Step 3. Parse the line i.e split the line in the above example based on ' ' (space).
Step 4. Once we get the start and end time while parsing the line, calculate the time difference and store this difference in a variable called diff_time.
Step 5. if (diff_time > 1 hour) { count++; }
Step 6. Print the count.

希望这有帮助

您能否在文件中提供示例数据?